home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
- Begin VB.Form pdfmain
- Caption = "FyTek PDF File Creator"
- ClientHeight = 7335
- ClientLeft = 165
- ClientTop = 735
- ClientWidth = 7650
- LinkTopic = "Form1"
- ScaleHeight = 7335
- ScaleWidth = 7650
- StartUpPosition = 3 'Windows Default
- Begin VB.CheckBox chk128
- Caption = "128-bit Encryption (Acrobat 5.0 or higher)"
- Height = 555
- Left = 4680
- TabIndex = 15
- Top = 6000
- Width = 2535
- End
- Begin VB.TextBox usrPass
- Height = 285
- Left = 4680
- TabIndex = 14
- Top = 5640
- Width = 2175
- End
- Begin VB.TextBox ownPass
- Height = 285
- Left = 4680
- TabIndex = 13
- Top = 5160
- Width = 2175
- End
- Begin VB.CheckBox chkMail
- Caption = "Attach to Email"
- Height = 315
- Left = 1560
- TabIndex = 12
- Top = 6120
- Width = 1815
- End
- Begin VB.CheckBox chkPrint
- Caption = "Print"
- Height = 375
- Left = 1560
- TabIndex = 11
- Top = 5640
- Width = 1335
- End
- Begin VB.CheckBox chkPreview
- Caption = "Preview"
- Height = 375
- Left = 1560
- TabIndex = 10
- Top = 5160
- Value = 1 'Checked
- Width = 1335
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 360
- Top = 5040
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 3
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "pdfmain.frx":0000
- Key = ""
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "pdfmain.frx":011C
- Key = ""
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "pdfmain.frx":0234
- Key = ""
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.Toolbar Toolbar1
- Align = 1 'Align Top
- Height = 570
- Left = 0
- TabIndex = 9
- Top = 0
- Width = 7650
- _ExtentX = 13494
- _ExtentY = 1005
- ButtonWidth = 873
- ButtonHeight = 953
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 5
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "New"
- ImageIndex = 1
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- ImageIndex = 2
- Style = 3
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "Open"
- ImageIndex = 2
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "Save"
- ImageIndex = 3
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- EndProperty
- End
- Begin VB.TextBox txtEditor
- BeginProperty Font
- Name = "Courier New"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 3315
- Left = 5
- MultiLine = -1 'True
- ScrollBars = 3 'Both
- TabIndex = 8
- Top = 660
- Width = 6900
- End
- Begin VB.TextBox infile
- Height = 285
- Left = 1560
- TabIndex = 6
- Top = 4260
- Width = 5415
- End
- Begin VB.CommandButton cmdInput
- Caption = "..."
- Height = 255
- Left = 1200
- TabIndex = 5
- Top = 4260
- Width = 315
- End
- Begin MSComctlLib.StatusBar StatusBar1
- Align = 2 'Align Bottom
- Height = 375
- Left = 0
- TabIndex = 4
- Top = 6960
- Width = 7650
- _ExtentX = 13494
- _ExtentY = 661
- _Version = 393216
- BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
- NumPanels = 1
- BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
- Object.Width = 8819
- MinWidth = 8819
- EndProperty
- EndProperty
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 960
- Top = 5040
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin VB.CommandButton cmdOutput
- Caption = "..."
- Height = 255
- Left = 1200
- TabIndex = 3
- Top = 4680
- Width = 315
- End
- Begin VB.CommandButton go
- Caption = "Create PDF"
- Height = 375
- Left = 3120
- TabIndex = 2
- Top = 6480
- Width = 1335
- End
- Begin VB.TextBox outfile
- Height = 285
- Left = 1560
- TabIndex = 1
- Top = 4680
- Width = 5415
- End
- Begin VB.Label Label1
- Caption = "User Password"
- Height = 255
- Left = 3360
- TabIndex = 17
- Top = 5655
- Width = 1335
- End
- Begin VB.Label ownLabel
- Caption = "Owner Password"
- Height = 255
- Left = 3240
- TabIndex = 16
- Top = 5175
- Width = 1335
- End
- Begin VB.Label lab_infile
- Alignment = 1 'Right Justify
- Caption = "Input File"
- Height = 255
- Left = 120
- TabIndex = 7
- Top = 4260
- Width = 975
- End
- Begin VB.Label lab_outfile
- Alignment = 1 'Right Justify
- Caption = "Output File"
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 4680
- Width = 975
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuNewScript
- Caption = "&New Script"
- End
- Begin VB.Menu mnuOpenScript
- Caption = "&Open Script"
- End
- Begin VB.Menu mnuSpacer1
- Caption = "-"
- End
- Begin VB.Menu mnuSave
- Caption = "&Save"
- End
- Begin VB.Menu mnuSaveAs
- Caption = "Save &As"
- End
- Begin VB.Menu mnuSpacer2
- Caption = "-"
- End
- Begin VB.Menu mnuCreatePDF
- Caption = "&Create PDF"
- End
- Begin VB.Menu mnuSpacer3
- Caption = "-"
- End
- Begin VB.Menu Exit
- Caption = "E&xit"
- End
- End
- Attribute VB_Name = "pdfmain"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Public CancelUnload As Boolean
- Private Sub cmdInput_Click()
- OpenScript
- End Sub
- Private Sub cmdOutput_Click()
- CommonDialog1.DefaultExt = ".rpt"
- CommonDialog1.Filter = "Adobe Acrobat|*.pdf"
- CommonDialog1.ShowOpen
- outfile.Text = CommonDialog1.FileName
- End Sub
- Private Sub Exit_Click()
- Unload Me
- End Sub
- Private Sub Form_Load()
- bolScriptNeedsSaving = False
- Toolbar1.Buttons(4).Enabled = False
- End Sub
- Private Sub Form_Resize()
- txtEditor.Width = pdfmain.Width - 100
- End Sub
- Public Sub Form_Unload(Cancel As Integer)
- CheckForSave
- If CancelUnload Then Cancel = 1
- End Sub
- Private Sub go_Click()
- CreatePDF
- End Sub
- Public Sub OpenScript()
- CommonDialog1.InitDir = App.Path
- CommonDialog1.DefaultExt = ".rpt"
- CommonDialog1.Filter = "PDF Creator|*.rpt"
- CommonDialog1.ShowOpen
- If CommonDialog1.FileName = "" Then Exit Sub
- strScriptFilePath = CommonDialog1.FileName
- infile.Text = strScriptFilePath
- StatusBar1.Panels(1).Text = "Opening " & infile.Text
- If Not (FileSys.FileExists(infile.Text)) Then
- MsgBox "File does not exist"
- Exit Sub
- End If
- Open infile.Text For Input As #1
- Do Until EOF(1)
- Line Input #1, strLineInput
- If Not EOF(1) Then
- strFileInput = strFileInput & strLineInput & vbCrLf
- Else
- strFileInput = strFileInput & strLineInput
- End If
- Close #1
- StatusBar1.Panels(1).Text = ""
- txtEditor.Text = strFileInput
- bolScriptNeedsSaving = False
- Toolbar1.Buttons(4).Enabled = False
- End Sub
- Public Sub SaveScript()
- If Not (FileSys.FileExists(infile.Text)) Then
- CommonDialog1.InitDir = App.Path
- CommonDialog1.DefaultExt = ".rpt"
- CommonDialog1.Filter = "PDF Creator|*.rpt"
- CommonDialog1.ShowOpen
- End If
- If CommonDialog1.FileName = "" Then Exit Sub
- strScriptFilePath = CommonDialog1.FileName
- infile.Text = strScriptFilePath
- FileSys.DeleteFile (strScriptFilePath)
- StatusBar1.Panels(1).Text = "Saving " & strScriptFilePath
- Open strScriptFilePath For Binary As #1
- Put #1, , txtEditor.Text
- Close #1
- bolScriptNeedsSaving = False
- Toolbar1.Buttons(4).Enabled = False
- StatusBar1.Panels(1).Text = ""
- End Sub
- Private Sub mnuCreatePDF_Click()
- CreatePDF
- End Sub
- Private Sub mnuNewScript_Click()
- NewScript
- End Sub
- Private Sub mnuOpenScript_Click()
- OpenScript
- End Sub
- Private Sub PDF_Error(errCode As Long, errDesc As String)
- MsgBox "PDFCreator.dll error #" & errCode & vbCrLf & _
- errDesc
- End Sub
- Private Sub mnuSave_Click()
- SaveScript
- End Sub
- Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Index
- Case 1
- NewScript
- Case 3 ' Open Button
- OpenScript
- Case 4
- SaveScript
- End Select
- End Sub
- Private Sub txtEditor_Change()
- If bolScriptNeedsSaving = True Then
- Exit Sub
- bolScriptNeedsSaving = True
- Toolbar1.Buttons(4).Enabled = True
- End If
- End Sub
- Private Sub NewScript()
- Dim intResult As Integer
- CheckForSave
- txtEditor.Text = ""
- bolScriptNeedsSaving = False
- Toolbar1.Buttons(4).Enabled = False
- End Sub
- Public Sub CheckForSave()
- ' If the script needs to be saved, then prompt the user
- ' otherwise, simply continue on to clearing the
- ' text box
- CancelUnload = False
- If bolScriptNeedsSaving = True Then
- intResult = MsgBox("Do you want to save your current script?", vbYesNoCancel, "Script needs saving")
- If intResult = vbCancel Then
- CancelUnload = True
- Exit Sub
- ElseIf intResult = vbYes Then
- SaveScript
- End If
- End If
- End Sub
- Public Sub CreatePDF()
- Dim PDF As Object
- Set PDF = CreateObject("build.PDF")
- strPDFFilePath = FormatFileName(Trim(outfile.Text))
- PDF.setOutFile (strPDFFilePath)
- Me.MousePointer = vbHourglass
- StatusBar1.Panels(1).Text = "Creating PDF File"
- ' Split the string up into individual lines in an array
- strScriptArray = Split(txtEditor.Text, vbCrLf)
- For i = 0 To UBound(strScriptArray)
- PDF.setPDFCmd (strScriptArray(i))
- If chkPrint.Value = vbChecked Then PDF.setPrint
- If chkMail.Value = vbChecked Then PDF.setMail
- If ownPass.Text <> "" Then PDF.setOwner (ownPass.Text)
- If usrPass.Text <> "" Then PDF.setUser (usrPass.Text)
- If chk128.Value = vbChecked Then PDF.setEncrypt128
- retval = PDF.buildPDF
- Me.MousePointer = vbNormal
- If chkPreview.Value = vbChecked Then
- StatusBar1.Panels(1).Text = "Opening Adobe Acrobat"
- Unload frmPDFPreview
- frmPDFPreview.Pdf1.src = strPDFFilePath
- frmPDFPreview.Show
- StatusBar1.Panels(1).Text = ""
- End If
- Set PDF = Nothing
- End Sub
-